$(document).ready(function() {
	var contextPath = document.location.pathname;
	var index = contextPath.substr(1).indexOf("/");
	contextPath = contextPath.substr(1, index);
	var basePath = "/" + contextPath;
	var validObject = $("#userInfo").Validform({
		
		dataType:'text',
		tiptype:2,
		ajaxPost:true,
		callback:function(data){
			if(data==0){
        		window.location=basePath+"/index.jsp";
        	}
        	else if(data==1){
        		
        		alert("登陆失败，如果邮箱登陆失败的话，可能是还没激活！");
        	}
        	else{
        		alert("验证码错误!");
        		var obj = document.getElementById("checkCode");
				changeValidateCode(obj);
        	}
		},
		
		tiptype:function(msg,o,cssctl){
			
			if(!o.obj.is("form")){
				var tds=o.obj.text();
				
				var objtip=o.obj.siblings(".Validform_checktip");
				cssctl(objtip,o.type);
				objtip.text(msg);
			
				
			}	
			
		}
	
	});
	

});

/**
 * 刷新
 */
function refresh() {
	window.location.reload();
}
function changeValidateCode(obj) {
	var timeNow = new Date().getTime();
	obj.src = "./CheckCode.do?time=" + timeNow;
}